package com.fjnu.dao.impl;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.fjnu.dao.IPermissionDao;
import com.fjnu.dao.common.BaseDaoImpl;
import com.fjnu.dao.common.DaoException;
import com.fjnu.entities.Permission;


@Repository("permissionDao")
public class PermissionDAO extends BaseDaoImpl<Permission> implements IPermissionDao{

	@Override
	public void addPermission(Permission p) {
		save(p);
		
	}

	@Override
	public void delPermission(int id) {
		delete(id);
		
	}


	public List<Permission> findAllPermission() {
		String hql="from Permission";
		List<Permission> list=findByHQL(hql);
		if(list.size()==0){
			throw new DaoException("权限信息为空");
		}
		return list;
	}


	public Permission findPermissionUnique(int id) {
		
		return findById(id);
	}
}
